<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(9)

ID=request("ID")

if request("action")="EditEmail" then
	Set rs=server.CreateObject("ADODB.RECORDSET")
	sql="select * from Mail_Setting where ID=1"
	rs.open sql,conn,1,3
	rs("Mailhostserver")=trim(request("Mailhostserver"))
	rs("MailUser")=trim(request("MailUser"))
	rs("MailPwd")=trim(request("MailPwd"))
	rs("MailSMTP")=trim(request("MailSMTP"))
	rs("MailPort")=trim(request("MailPort"))
	rs("MailTLS")=trim(request("MailTLS"))
	rs("MailAccept")=trim(request("MailAccept"))
	rs("MailOpen")=trim(request("MailOpen"))
	rs.update
	rs.close
	set rs=nothing
	alert("保存成功!")
	Go("?showMsgStr=<br><b>邮件参数设置信息已保存成功！</b>|parent|3000|500||")
end if

enableIco="<div class='left icoBtn_do_i'><div class='btnIco btnChange'></div></div>"
disabledIco="<div class='left icoBtn_do_i'><div class='btnIco btnDel'></div></div>"
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>邮件参数设置</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript" type="text/javascript">
function checkfrmMail(){
	if(document.frmMail.Mailhostserver.value==""){
		alert("请输入邮件地址！");
		document.frmMail.Mailhostserver.focus();
		return false;
	}
	if(document.frmMail.MailUser.value==""){
		alert("请输入用户名！");
		document.frmMail.MailUser.focus();
		return false;
	}
	if(document.frmMail.MailPwd.value==""){
		alert("请输入密码！");
		document.frmMail.MailPwd.focus();
		return false;
	}
	if(document.frmMail.MailPwd2.value==""){
		alert("请输入确认密码！");
		document.frmMail.MailPwd2.focus();
		return false;
	}
	if(document.frmMail.MailPwd.value!=document.frmMail.MailPwd2.value){
		alert("确认密码不正确！");
		document.frmMail.MailPwd2.focus();
		return false;
	}
	if(document.frmMail.MailSMTP.value==""){
		alert("请输入邮件发送服务器地址（SMTP）！");
		document.frmMail.MailSMTP.focus();
		return false;
	}
}
</script>
<body>
    <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
	    <div id="guide"></div>
    </div>
	<div id="MainContent">
<%
	Set rs=server.CreateObject("ADODB.RECORDSET")
	sql="select * from Mail_Setting where ID=1"
	rs.open sql,conn,1,1
%>
<form method="POST" id="frmMail" name="frmMail" action="?action=EditEmail" onSubmit="return checkfrmMail()">
  <table cellpadding="4" class="cTable_2 table">
		<tr class="cTitle toolbarBg">
			<td colspan="2"><div class="cLeftPadding">邮件功能参数设置</div></td>
		</tr>
		<tr>
		  <td width="25%" align="right">当前选择及支持状态：</td>
		  <td>
			<%
			if MailSend_con=True then
				select case MailSendApp_con
					case 1
						response.Write("<div class='left' style='line-height:20px'>Jmail组件</div>")
					    If Not IsObjInstalled("JMail.SMTPMail") Then
					    	response.Write disabledIco
					    else
					    	response.Write enableIco
					    end if
					case 2
						response.Write("<div class='left' style='line-height:20px'>AspEmail组件</div>")
					    If Not IsObjInstalled("Persits.MailSender") Then
					    	response.Write disabledIco
					    else
					    	response.Write enableIco
					    end if
					case 3
						response.Write("<div class='left' style='line-height:20px'>CDO组件：</div>")
						response.Write("<div class='left' style='line-height:20px'>CDO.Message</div>")
					    If Not IsObjInstalled("CDO.Message") Then
					    	response.Write disabledIco
					    else
					    	response.Write enableIco
					    end if
						response.Write("<div class='left' style='line-height:20px'>CDO.Configuration</div>")
					    If Not IsObjInstalled("CDO.Configuration") Then
					    	response.Write disabledIco
					    else
					    	response.Write enableIco
					    end if
					case else
						response.Write("<span class='light_red'>Error: 对不起，系统参数设置未选择相应应用组件！</span>")
				end select
			else
				response.Write("<span class='light_red'>Error: 对不起，系统参数设置未开启，请开启后使用！</span>")
			end if
			%>		  </td>
	  </tr>
		<tr>
		  <td align="right">使用说明：</td>
		  <td>使用邮件功能前请确定您的邮箱是否支持POP-SMTP功能!</td>
	  </tr>
		<tr>
			<td align="right">
				邮件地址：</td>
		    <td><input name="Mailhostserver" type="text" maxlength="100" style="width:250px;" value="<%=rs("Mailhostserver")%>" />
		      如：UserID@domain.com</td>
		</tr>
		<tr>
			<td align="right">
				用户名：		  </td>
		    <td><input name="MailUser" type="text" maxlength="100" style="width:250px;" value="<%=rs("MailUser")%>" />
		      一般与邮件地址一致</td>
		</tr>
		<tr>
			<td align="right">
				密码：				</td>
		    <td><input name="MailPwd" type="password" maxlength="100" style="width:250px;" value="<%=rs("MailPwd")%>" /></td>
		</tr>
		<tr>
		  <td align="right">
				确认密码：			</td>
		  <td><input name="MailPwd2" type="password" maxlength="100" style="width:250px;" value="<%=rs("MailPwd")%>" /></td>
		</tr>
		<tr>
		  <td align="right">邮件发送服务器地址（SMTP）：</td>
		  <td><input name="MailSMTP" type="text" maxlength="100" style="width:250px;" value="<%=rs("MailSMTP")%>" />
		    如：smtp.domain.com</td>
	  </tr>
		<tr>
		  <td align="right">协议端口：</td>
		  <td><input name="MailPort" type="text" maxlength="100" style="width:250px;" value="<%=rs("MailPort")%>" />
		    默认值为25，无特殊要求请不要更改</td>
	  </tr>
		<tr style="display:<%if MailSendApp_con<=1 then response.Write("none")%>">
		  <td align="right">TLS/SSL安全链接：</td>
		  <td>
		  <input type="radio" name="MailTLS" value="True" <%if rs("MailTLS")=True then response.Write("checked")%>>开启
		  <input type="radio" name="MailTLS" value="False" <%if rs("MailTLS")=False then response.Write("checked")%>>关闭
		  </td>
	  </tr>
		<tr>
		  <td align="right">邮件接收地址</td>
		  <td><input name="MailAccept" type="text" maxlength="100" style="width:250px;" value="<%=rs("MailAccept")%>" />
		    如：user@domain.com</td>
	  </tr>
		<tr>
		  <td align="right">是否开启：</td>
		  <td>
		  <input type="radio" name="MailOpen" value="True" <%if rs("MailOpen")=True then response.Write("checked")%>>开启
		  <input type="radio" name="MailOpen" value="False" <%if rs("MailOpen")=False then response.Write("checked")%>>关闭
		  </td>
	  </tr>
	</table> 
    <div id="cEndToolbar" class="toolbarBg">
      <div class="caButCase">
	  <input type="submit" name="btnSubmitMail" value="确 定" class="button" />
      </div>
    </div>
	</form>
<%
rs.close
Set rs=nothing
%>
	</div>
</body>
</html>